//
//  UIImage+Handle.h
//  XLProject
//
//  Created by xinglian on 2021/9/7.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIImage (Handle)


//生成bmp
- (NSData *)bitmapData;
- (NSData *)bitmapFileHeaderData;
- (NSData *)bitmapDataWithFileHeader;

- (UIImage *)bitmapData2;


+ (UIImage *)imageWithMaxSide:(CGFloat)length sourceImage:(UIImage *)image;



/**
 *  调整图片尺寸和大小
 *
 *  @param sourceImage  原始图片
 *  @param maxImageSize 新图片最大尺寸
 *  @param maxSize      新图片最大存储大小
 *
 *  @return 新图片imageData
 */
+ (NSData *)reSizeImageData:(UIImage *)sourceImage maxImageSize:(CGFloat)maxImageSize maxSizeWithKB:(CGFloat) maxSize;


+ (NSData *)newBitmapRGBA8ContextFromImage:(CGImageRef) image ;


- (NSData *)createImageDataWithImage:(UIImage *)inImage writetype:(NSInteger)type;



+ (unsigned short) RGB888ToRGB565:(unsigned int)n888Color;



@end

NS_ASSUME_NONNULL_END
